﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DevExpress.Xpo;
namespace ChuanPlus
{
    public class ReceiptVoucher : XPLiteObject
    {
        int fReceiptID;
        [Key(true)]
        public int ReceiptID
        {
            get { return fReceiptID; }
            set { SetPropertyValue<int>("ReceiptID", ref fReceiptID, value); }
        }
        Customer fCustomerID;
        public Customer CustomerID
        {
            get { return fCustomerID; }
            set { SetPropertyValue<Customer>("CustomerID", ref fCustomerID, value); }
        }
        DateTime fReceiptDate;
        public DateTime ReceiptDate
        {
            get { return fReceiptDate; }
            set { SetPropertyValue<DateTime>("ReceiptDate", ref fReceiptDate, value); }
        }
        double fAmount;
        public double Amount
        {
            get { return fAmount; }
            set { SetPropertyValue<double>("Amount", ref fAmount, value); }
        }
        Users fReceivedBy;
        public Users ReceivedBy
        {
            get { return fReceivedBy; }
            set { SetPropertyValue<Users>("ReceivedBy", ref fReceivedBy, value); }
        }
        Users fCreatedBy;
        public Users CreatedBy
        {
            get { return fCreatedBy; }
            set { SetPropertyValue<Users>("CreatedBy", ref fCreatedBy, value); }
        }
        string fStatus;
        public string Status
        {
            get { return fStatus; }
            set { SetPropertyValue<string>("Status", ref fStatus, value); }
        }
        [Association("ReceiptVoucher-Payment")]
        public XPCollection<Payment> Payments { get { return GetCollection<Payment>("Payments"); } }        
        public ReceiptVoucher(Session session) : base(session) { }
        public ReceiptVoucher() : base(Session.DefaultSession) { }
        /// <summary>
        /// Initializes a new instance of the ReceiptVoucher class.
        /// </summary>
        /// <param name="fReceiptID"></param>
        /// <param name="fCustomerID"></param>
        /// <param name="fReceiptDate"></param>
        /// <param name="fAmount"></param>
        /// <param name="fReceivedBy"></param>
        /// <param name="fCreatedBy"></param>
        public ReceiptVoucher(Session session, int fReceiptID, Customer fCustomerID, DateTime fReceiptDate, double fAmount, Users fReceivedBy, Users fCreatedBy):base(session)
        {
            this.fReceiptID = fReceiptID;
            this.fCustomerID = fCustomerID;
            this.fReceiptDate = fReceiptDate;
            this.fAmount = fAmount;
            this.fReceivedBy = fReceivedBy;
            this.fCreatedBy = fCreatedBy;
            this.fStatus = "H";
        }
        public override void AfterConstruction() { base.AfterConstruction(); }
        /// <summary>
        /// Initializes a new instance of the ReceiptVoucher class.
        /// </summary>
        /// <param name="fCustomerID"></param>
        /// <param name="fReceiptDate"></param>
        /// <param name="fAmount"></param>
        /// <param name="fReceivedBy"></param>
        /// <param name="fCreatedBy"></param>
        public ReceiptVoucher(Customer fCustomerID, DateTime fReceiptDate, double fAmount, Users fReceivedBy, Users fCreatedBy)
        {
            this.fCustomerID = fCustomerID;
            this.fReceiptDate = fReceiptDate;
            this.fAmount = fAmount;
            this.fReceivedBy = fReceivedBy;
            this.fCreatedBy = fCreatedBy;
            this.fStatus = "H";
        }
    }
}
